<template>
  <div class="app-container">
    <el-table
      :data="tableData.rows"
      border
      style="width: 100%"
      max-height="600"
    >
      <el-table-column
        v-for="(column, index) in tableData.columns"
        :key="index"
        :prop="index.toString()"
        :label="column"
        min-width="180"
      >
        <template slot-scope="scope">
          {{ scope.row[index] }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getAllIndicators } from "@/api/data_analysis/baseData.js";
export default {
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      // this.$route.params跳转路径的时候带的参数
      const param = this.$route.params;
      console.log(param);

      getAllIndicators(param).then((response) => {
        console.log(response);
        this.tableData = response.data;
      });
    },
    columnStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex == 0 || columnIndex == 2 || columnIndex == 9) {
        return "background:	#f5f5f5;";
      }
    },
  },
};
</script>

<style></style>
